
/*
Date:				2017-2-07
Author:				GangTimes
Address:			JSB-0210-220
dependent file:  	iterator.h head.h

The file is a kind of implemation with queue.

*/


#ifndef QUEUE_H_
#define QUEUE_H_

#include"vector.h"
#include"list.h"

template < typename T, class Container = vector<T>>
class queue
{
public:
	typedef typename Container::value_type value_type;
	typedef typename Container::reference	reference;

private:
	Container node;
public:
	queue() :node()
	{
	}
	explicit queue(const queue & st) :queue()
	{
		for (auto temp = st.node.begin(); temp != st.node.end(); ++temp)
		{
			node.push_back(*temp);
		}
	}

	queue(const Container & st) :node(st)
	{
	}
	
	~queue()
	{
		node.clear();
	}
	
	void push(value_type d)
	{
		node.push_back(d);
	}

	bool isempty()
	{
		return node.isempty();
	}

	int size()
	{
		return node.size();
	}
	
	reference front()
	{
		return node.front();
	}
	
	reference back()
	{
		return node.back();
	}

	void pop()
	{
		node.pop_front();
	}
	
	void show()
	{
		int num = size();
		
		for (int i = 0; i<num; ++i)
		{
			cout << front() << endl;
			pop();
		}
	}

};
#endif